﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace Microfinance_Management
{
    unsafe public class MySQL
    {

        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern int Excute(string cmd);
        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern int ConnectSQL(string szDSN, string szUID, string szAuthStr);
       // [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
      //  public static extern void StartSelect(string cmd);

        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern void BindCol(int col, int type, void* point, int lenth);
        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern void EndSelect();
        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern int GetValue();

        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern int Login(string ID, string password);
        [DllImport("dll_win32.dll", CharSet = CharSet.Ansi)]
        public static extern void DisConnectSQL();
        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern bool ChangePassword(string ID, string Newpassword);
        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern bool ChangeType(string ID, int NewType);
        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern bool DisplayPersonalInfo(string ID, StringBuilder name, StringBuilder address, StringBuilder tel);
        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern bool startEmployInfo();
        [DllImport("loginDll.dll", CharSet = CharSet.Ansi)]
        public static extern bool DisplayEmployInfo(StringBuilder ID, StringBuilder name, StringBuilder address, StringBuilder tel);
    }
    public class App_dll
    {
        [DllImport("APPLY_DLL.dll", CharSet = CharSet.Ansi)]
        public static extern int GetAppNum();
         [DllImport("APPLY_DLL.dll", CharSet = CharSet.Ansi)]
        public static extern bool SendApplyForm(string name, string ID, string city, string country,
		string address,string postcode,string tel,string E_mail,string amount,string work_id,string lenth,
		string purpose,string G_name,string G_ID,string G_tel,string G_addr,string G_state);  
    }
    unsafe public class Payment_dll
    {
        [DllImport("PAYMENGT_DLL.dll", CharSet = CharSet.Ansi)]
        public static extern int Getpayment();
        [DllImport("PAYMENGT_DLL.dll", CharSet = CharSet.Ansi)]
        public static extern bool startGetLoan(string cust_id);
        [DllImport("PAYMENGT_DLL.dll", CharSet = CharSet.Ansi)]
        public static extern bool GetLoan(int* loan_num, StringBuilder start_date, StringBuilder due_date, StringBuilder check_date_date,int* amount);
    }
   unsafe  public class Research_dll
    {
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern int startStr(StringBuilder str);
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern bool GetWait(int* ID, int* Amount, int* App_num, StringBuilder name,StringBuilder date);
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern bool GetResearch(string ResearchID, StringBuilder cust_id, StringBuilder cust_name, StringBuilder cust_state, StringBuilder cust_city, StringBuilder cust_address,
                           StringBuilder cust_tel, StringBuilder E_mail, StringBuilder Gua_name, StringBuilder Gua_state, StringBuilder Gua_addr, StringBuilder Gua_tel);
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern int Out_dateStr();
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern bool GetOut_date(int* ID, StringBuilder date);
        [DllImport("Research.dll", CharSet = CharSet.Ansi)]
        public static extern bool GetCustInfo(string ResearchID, StringBuilder cust_id, StringBuilder cust_name, StringBuilder cust_state, StringBuilder cust_city, StringBuilder cust_address,
                           StringBuilder cust_tel, StringBuilder E_mail);

    }
   unsafe public class Approval_dll
   {
      [DllImport("APPROVAL.dll", CharSet = CharSet.Ansi)]
       public static extern int startStr(int itype);
       [DllImport("APPROVAL.dll", CharSet = CharSet.Ansi)]
      public static extern bool GetWait(StringBuilder date, int* number, StringBuilder ID);
       [DllImport("APPROVAL.dll", CharSet = CharSet.Ansi)]
       public static extern bool GetApp(string ResearchID, int* amount, StringBuilder usage, StringBuilder social_info, StringBuilder credit); 
   }
   unsafe public class Select_dll
   {
       [DllImport("Select.dll", CharSet = CharSet.Ansi)]
       public static extern bool GetCustInfo(string cust_id, StringBuilder cust_name, StringBuilder cust_state, StringBuilder cust_city, StringBuilder cust_address,
                           StringBuilder cust_tel, StringBuilder E_mail);
   }
}
